Optimal. Leaf size=86 \[ \frac {1}{2} a \left (a^2+3 b^2\right ) x-\frac {b^3 \log (\cos (c+d x))}{d}-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3587, 753, 788,
649, 209, 266} \begin {gather*} \frac {1}{2} a x \left (a^2+3 b^2\right )-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d}-\frac {b^3 \log (\cos (c+d x))}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 266
Rule 649
Rule 753
Rule 788
Rule 3587
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+b \tan (c+d x))^3 \, dx &=\frac {\text {Subst}\left (\int \frac {(a+x)^3}{\left (1+\frac {x^2}{b^2}\right )^2} \, dx,x,b \tan (c+d x)\right )}{b d}\\ &=-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d}+\frac {b \text {Subst}\left (\int \frac {(a+x) \left (2+\frac {a^2}{b^2}-\frac {a x}{b^2}\right )}{1+\frac {x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{2 d}\\ &=-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d}+\frac {b^3 \text {Subst}\left (\int \frac {\frac {a}{b^2}+\frac {a \left (2+\frac {a^2}{b^2}\right )}{b^2}+\frac {2 x}{b^2}}{1+\frac {x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{2 d}\\ &=-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d}+\frac {b \text {Subst}\left (\int \frac {x}{1+\frac {x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{d}+\frac {\left (a \left (a^2+3 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{2 b d}\\ &=\frac {1}{2} a \left (a^2+3 b^2\right ) x-\frac {b^3 \log (\cos (c+d x))}{d}-\frac {a b^2 \tan (c+d x)}{2 d}-\frac {\cos ^2(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(401\) vs. \(2(86)=172\).
time = 0.82, size = 401, normalized size = 4.66 \begin {gather*} \frac {5 a^4 b^2+2 a^2 b^4-b^6+\left (-3 a^4 b^2-2 a^2 b^4+b^6\right ) \cos (2 (c+d x))+2 a^2 b^4 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-3 a \left (-b^2\right )^{5/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 a^2 b^4 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+3 a b^4 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )-4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a b \left (a^4-2 a^2 b^2-3 b^4\right ) \sin (2 (c+d x))}{4 b \left (a^2+b^2\right ) d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.19, size = 98, normalized size = 1.14
method | result | size |
derivativedivides | \(\frac {b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+3 b^{2} a \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} \left (\cos ^{2}\left (d x +c \right )\right ) b}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(98\) |
default | \(\frac {b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+3 b^{2} a \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} \left (\cos ^{2}\left (d x +c \right )\right ) b}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(98\) |
risch | \(i x \,b^{3}+\frac {a^{3} x}{2}+\frac {3 a \,b^{2} x}{2}-\frac {3 \,{\mathrm e}^{2 i \left (d x +c \right )} b \,a^{2}}{8 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} b^{3}}{8 d}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{3}}{8 d}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} b^{2} a}{8 d}-\frac {3 \,{\mathrm e}^{-2 i \left (d x +c \right )} b \,a^{2}}{8 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} b^{3}}{8 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{3}}{8 d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} b^{2} a}{8 d}+\frac {2 i b^{3} c}{d}-\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(196\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 81, normalized size = 0.94 \begin {gather*} \frac {b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + {\left (a^{3} + 3 \, a b^{2}\right )} {\left (d x + c\right )} - \frac {3 \, a^{2} b - b^{3} - {\left (a^{3} - 3 \, a b^{2}\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.47, size = 79, normalized size = 0.92 \begin {gather*} -\frac {2 \, b^{3} \log \left (-\cos \left (d x + c\right )\right ) - {\left (a^{3} + 3 \, a b^{2}\right )} d x + {\left (3 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )^{2} - {\left (a^{3} - 3 \, a b^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{3} \cos ^{2}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 601 vs.
\(2 (81) = 162\).
time = 0.95, size = 601, normalized size = 6.99 \begin {gather*} \frac {2 \, a^{3} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 6 \, a b^{2} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 2 \, a^{3} d x \tan \left (d x\right )^{2} + 6 \, a b^{2} d x \tan \left (d x\right )^{2} + 2 \, a^{3} d x \tan \left (c\right )^{2} + 6 \, a b^{2} d x \tan \left (c\right )^{2} - 3 \, a^{2} b \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + b^{3} \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 2 \, b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} - 2 \, a^{3} \tan \left (d x\right )^{2} \tan \left (c\right ) + 6 \, a b^{2} \tan \left (d x\right )^{2} \tan \left (c\right ) - 2 \, b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (c\right )^{2} - 2 \, a^{3} \tan \left (d x\right ) \tan \left (c\right )^{2} + 6 \, a b^{2} \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, a^{3} d x + 6 \, a b^{2} d x + 3 \, a^{2} b \tan \left (d x\right )^{2} - b^{3} \tan \left (d x\right )^{2} + 12 \, a^{2} b \tan \left (d x\right ) \tan \left (c\right ) - 4 \, b^{3} \tan \left (d x\right ) \tan \left (c\right ) + 3 \, a^{2} b \tan \left (c\right )^{2} - b^{3} \tan \left (c\right )^{2} - 2 \, b^{3} \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 2 \, a^{3} \tan \left (d x\right ) - 6 \, a b^{2} \tan \left (d x\right ) + 2 \, a^{3} \tan \left (c\right ) - 6 \, a b^{2} \tan \left (c\right ) - 3 \, a^{2} b + b^{3}}{4 \, {\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + d \tan \left (d x\right )^{2} + d \tan \left (c\right )^{2} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.66, size = 141, normalized size = 1.64 \begin {gather*} \frac {b^3\,\ln \left (\frac {1}{{\cos \left (c+d\,x\right )}^2}\right )}{2\,d}+\frac {b^3\,{\cos \left (c+d\,x\right )}^2}{2\,d}+\frac {a^3\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )}{2\,d}-\frac {3\,a^2\,b\,{\cos \left (c+d\,x\right )}^2}{2\,d}+\frac {3\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )}{2\,d}+\frac {a^3\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{2\,d}-\frac {3\,a\,b^2\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________